package demo12;

import java.util.ArrayList;

/*class Login{
    private  String userName;
    private  String passWord;
    public String getUserName(){
        return userName;
    }
    public String getPassWord(){
        return passWord;
    }
    public void setUserName(String userName){
        this.userName =userName;
    }
    public void setPassWord(String passWord){
        this.passWord =passWord;
    }
    public void logInfo(String userName,String passWord){
        if(!this.userName.equals(userName)){
            System.out.println("用户名错误");
            return;
        }
        if(!this.passWord.equals(passWord)){
            System.out.println("密码错误");
            return;
        }
        System.out.println("登陆成功");
    }
}*/
class Login{
    private  String userName;
    private  String passWord;
    public String getUserName(){
        return userName;
    }
    public String getPassWord(){
        return passWord;
    }
    public void setUserName(String userName){
        this.userName =userName;
    }
    public void setPassWord(String passWord){
        this.passWord =passWord;
    }
    public void logInfo(String userName,String passWord) throws  userNameException,PassWordException{
        if(!this.userName.equals(userName)){
            throw new userNameException("用户名错误异常");
        }
        if(!this.passWord.equals(passWord)){
            throw new PassWordException("密码错误异常");
        }
        System.out.println("登陆成功");
    }
}
public class Test2 {
    public static void main(String[] args) {
        Login login =new Login();
        login.setUserName("liyongxing6018");
        login.setPassWord("123456");
        try{
            login.logInfo("wentao123","5670890");
        }catch (userNameException e){
            e.printStackTrace();
        }catch (PassWordException e){
            e.printStackTrace();
        }finally{

        }
    }
    public static void main1(String[] args) {
        ArrayList<Integer>list =new ArrayList<>();
    }
}
